<template>
  <div>
    <el-button type="primary" size="small" @click="addTitle">新增题目</el-button>
    <el-table :data="tableData" style="width: 100%; margin-top : 15px" height="250">
      <el-table-column type="index" label="#" width="70" align="center"></el-table-column>
      <el-table-column prop="题目" label="题目" width="550"></el-table-column>
      <el-table-column prop="分类" label="分类" width="100"></el-table-column>
      <el-table-column prop="作者" label="作者" width="100"></el-table-column>
      <el-table-column prop="发布时间" label="发布时间" width="300"></el-table-column>
    </el-table>
    <el-drawer :wrapperClosable="false" :visible.sync="drawer" size="50%" :direction="direction">
      <div style="margin-right : 20px">
        <el-form ref="form" :model="form" label-width="80px">
          <el-form-item label="题目">
            <el-input v-model="form.name" type="textarea"></el-input>
          </el-form-item>
          <el-form-item label="分类">
            <el-select v-model="form.region" placeholder="请选择类型">
              <el-option label="区域一" value="shanghai"></el-option>
              <el-option label="区域二" value="beijing"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="选项">
            <el-checkbox-group v-model="form.type">
              <div class="flex">
                  <el-checkbox  name="type"></el-checkbox>
                  <el-input v-model="input" type="textarea" placeholder="请输入内容" class="margin"></el-input>
              </div>
              <div class="flexs">
                  <el-checkbox  name="type"></el-checkbox>
                  <el-input v-model="input" type="textarea" placeholder="请输入内容" class="margin"></el-input>
              </div>
              <div class="flexs">
                  <el-checkbox  name="type"></el-checkbox>
                  <el-input v-model="input" type="textarea" placeholder="请输入内容" class="margin"></el-input>
              </div>
              <div class="flexs">
                  <el-checkbox  name="type"></el-checkbox>
                  <el-input v-model="input" type="textarea" placeholder="请输入内容" class="margin"></el-input>
              </div>
            </el-checkbox-group>
          </el-form-item>
          <el-form-item label="答案提示">
            <el-input v-model="form.name" type="textarea"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onSubmit">立即创建</el-button>
            <el-button @click="drawer=false">取消</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-drawer>
  </div>
</template>

<script>
export default {
  layout: "mian",
  data() {
    return {
      tableData: [
        
      ],
      drawer: false,
      direction: "rtl",
      form: {
          type : []
      }
    };
  },
  methods: {
    addTitle() {
      this.drawer = true;
    },
    onSubmit() {
      console.log("submit!");
    }
  }
};
</script>

<style scoped>
.flex {
    display: flex;
}

.flexs {
    display: flex;
    margin-top: 15px;
}

.margin {
    margin-left: 25px;
}
</style>